NavigationViewModel

class NavigationViewModel @Inject constructor(userRepository: UserRepository) : ViewModel

ViewModel responsible for managing the navigation drawer UI state, specifically tracking the user's login state, and providing it to the UI layer.

The NavigationViewModel uses the UserRepository to observe the user's authentication state and updates the UI state accordingly. It listens for changes in the authentication state and reflects these changes in the NavDrawerUiState.

This ViewModel is scoped to the lifecycle of the navigation UI and ensures that the UI is updated with the correct login state based on the user's authentication status.

Parameters

userRepository

The repository that handles user authentication and retrieval of authentication state. Injected via Hilt for dependency management.

Constructors

Link copied to clipboard
@Inject
constructor(userRepository: UserRepository)

Properties

Link copied to clipboard
val uiState: StateFlow<NavDrawerUiState>

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard